﻿using LY.DataAccess.Repository;
using LY.Entity;
using LY.Entity.PageSearch;
using LY.Entity.SearchEntity;
using LY.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LY.Business.ServiceImpl
{
    public class ProjectItemService : IProjectItemService
    {
        ProjectItemRepository _pro;

        public ProjectItemService()
        {
            _pro = new ProjectItemRepository();
        }
        //获取回报列表
        public PagedList<R_ProjectItem> GetProjectItem(int id, PageView view)
        {
            return _pro.GetProjectItemList(id, view);
        }

        //获取单个回报对象
        public R_ProjectItem GetProjectItem(int? id)
        {
            return _pro.GetProjectItem(id);
        }
        //新增或修改
        public int SaveProjectItem(R_ProjectItem pro)
        {
            if (pro.Id <= 0)
            {
                //执行新增操作
                return (int)_pro.Insert(pro);
            }
            else
            {
                //执行修改操作
                return (int)_pro.Update(pro);
            }
        }

        //删除
        public int deleteProjectItem(int id)
        {
            return _pro.DeleteProjectItem(id);
        }
        //根据项目id删除回报
        public int DeleteItemByProID(int id)
        {
            return _pro.DeleteItemByProID(id);
        }
    }
}
